import java.util.ArrayList;

public class Demo {
    public static void main(String[] args) {
        StudentCourseManager manager = new StudentCourseManager();

        // 创建学生
        Student s1 = new Student("20160001", "孙悟空", new ArrayList<>());
        Student s2 = new Student("20160002", "猪八戒", new ArrayList<>());
        Student s3 = new Student("20160003", "沙和尚", new ArrayList<>());
        Student s4 = new Student("20160004", "唐僧", new ArrayList<>());
        Student s5 = new Student("201620035", "牛魔王", new ArrayList<>());

        // 创建课程
        Course c1 = new Course("C001", "大学英语", 56, 3);
        Course c2 = new Course("C002", "计算机基础", 32, 2);
        Course c3 = new Course("C003", "高等数学", 80, 5);
        Course c4 = new Course("C004", "大学体育", 28, 2);

        // 添加选课信息
        manager.add(s1, c1);
        manager.add(s2, c2);
        manager.add(s3, c2);
        manager.add(s4, c3);
        manager.add(s5, c4);

        // 显示所有选课信息
        manager.showAll();

        // 显示所有学生
        System.out.println("\n所有学生信息:");
        manager.showStudent();

        // 显示所有课程
        System.out.println("\n所有课程信息:");
        manager.showCourse();

        // 查找学生的选课信息
        System.out.println("\n孙悟空的选课信息:");
        ArrayList<Course> courses = manager.searching(s1);
        for (Course course : courses) {
            System.out.println(course);
        }

        // 查找选修某课程的学生
        System.out.println("\n选修计算机基础的学生:");
        ArrayList<Student> students = manager.searching(c2);
        for (Student student : students) {
            System.out.println(student);
        }
    }
}    